package com.doge.calcalbum.api

object ErrorHandler {
    private const val HTTP_SUCCESS = 200

    fun process(resp: ApiResult<*>?) {
        when {
            resp == null -> {
                throw ServerException(-999, "resp null pointer")
            }
            resp.code != HTTP_SUCCESS -> {
                throw ServerException(resp.code, resp.message ?: "")
            }
        }
    }
}